65. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:08:40 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

65.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeLatestList.php2018-01-11 10:49:08 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeLatestList.php2021-04-02 11:49:30 +0000

65.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged12152
Changed924
Inserted00
Removed22

65.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

65.4 Active regular expressions

No regular expressions were active.

65.5 Comparison detail

1 <?php 1 <?php
2  2 
3 namespace Smartwave\Filterproducts\Block\Home; 3 namespace Smartwave\Filterproducts\Block\Home;
4  4 
5 use Magento\Catalog\Api\CategoryRepositoryInterface; 5 use Magento\Catalog\Api\CategoryRepositoryInterface;
6  6 
7 class LatestList extends \Magento\Catalog\Block\Product\ListProduct { 7 class LatestList extends \Magento\Catalog\Block\Product\ListProduct {
8  8 
9     protected $_collection; 9     protected $_collection;
10  10 
11     protected $categoryRepository; 11     protected $categoryRepository;
12      12 
13     protected $_resource; 13     protected $_resource;
14      14 
15     public function __construct( 15     public function __construct(
16     \Magento\Catalog\Block\Product\Context $context,  16     \Magento\Catalog\Block\Product\Context $context,
17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper,  17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
18             \Magento\Catalog\Model\Layer\Resolver $layerResolver,  18             \Magento\Catalog\Model\Layer\Resolver $layerResolver,
19             CategoryRepositoryInterface $categoryRepository, 19             CategoryRepositoryInterface $categoryRepository,
20             \Magento\Framework\Url\Helper\Data $urlHelper,  20             \Magento\Framework\Url\Helper\Data $urlHelper,
21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection,  21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection,
22             \Magento\Framework\App\ResourceConnection $resource, 22             \Magento\Framework\App\ResourceConnection $resource,
23             array $data = [] 23             array $data = []
24     ) { 24     ) {
25         $this->categoryRepository = $categoryRepository; 25         $this->categoryRepository = $categoryRepository;
26         $this->_collection = $collection; 26         $this->_collection = $collection;
27         $this->_resource = $resource; 27         $this->_resource = $resource;
28  28 
29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data); 29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data);
30     } 30     }
31  31 
32     protected function _getProductCollection() { 32     protected function _getProductCollection() {
33         return $this->getProducts(); 33         return $this->getProducts();
34     } 34     }
35      35 
36     public function getProducts() { 36     public function getProducts() {
37         $count = $this->getProductCount();                        37         $count = $this->getProductCount();
38         $category_id = $this->getData("category_id"); 38         $category_id = $this->getData("category_id");
39         $collection = clone $this->_collection; 39         $collection = clone $this->_collection;
40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP); 40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP);
41          41 
42         if(!$category_id) { 42         if(!$category_id) {
43             $category_id = $this->_storeManager->getStore()->getRootCategoryId(); 43             $category_id = $this->_storeManager->getStore()->getRootCategoryId();
44         } 44         }
45         $category = $this->categoryRepository->get($category_id); 45         $category = $this->categoryRepository->get($category_id);
46         if(isset($category) && $category) { 46         if(isset($category) && $category) {
47             $collection->addMinimalPrice() 47             $collection->addMinimalPrice()
48                 ->addFinalPrice() 48                 ->addFinalPrice()
49                 ->addTaxPercents() 49                 ->addTaxPercents()
50                 ->addAttributeToSelect('name') 50                 ->addAttributeToSelect('name')
51                 ->addAttributeToSelect('image') 51                 ->addAttributeToSelect('image')
52                 ->addAttributeToSelect('small_image') 52                 ->addAttributeToSelect('small_image')
53                 ->addAttributeToSelect('thumbnail') 53                 ->addAttributeToSelect('thumbnail')
54                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes()) 54                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
55                 ->addUrlRewrite() 55                 ->addUrlRewrite()
56                 ->addAttributeToFilter('is_saleable', 1, 'left')    
57                 ->addCategoryFilter($category) 56                 ->addCategoryFilter($category)
58                 ->addAttributeToSort('created_at','desc'); 57                 ->addAttributeToSort('created_at','desc');
59         } else { 58         } else {
60             $collection->addMinimalPrice() 59             $collection->addMinimalPrice()
61                 ->addFinalPrice() 60                 ->addFinalPrice()
62                 ->addTaxPercents() 61                 ->addTaxPercents()
63                 ->addAttributeToSelect('name') 62                 ->addAttributeToSelect('name')
64                 ->addAttributeToSelect('image') 63                 ->addAttributeToSelect('image')
65                 ->addAttributeToSelect('small_image') 64                 ->addAttributeToSelect('small_image')
66                 ->addAttributeToSelect('thumbnail') 65                 ->addAttributeToSelect('thumbnail')
67                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes()) 66                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
68                 ->addUrlRewrite() 67                 ->addUrlRewrite()
69                 ->addAttributeToFilter('is_saleable', 1, 'left')    
70                 ->addAttributeToSort('created_at','desc'); 68                 ->addAttributeToSort('created_at','desc');
71         } 69         }
72          70 
73         $collection->getSelect() 71         $collection->getSelect()
74                 ->order('created_at','desc') 72                 ->order('created_at','desc')
75                 ->limit($count); 73                 ->limit($count);
76                  74 
77         return $collection; 75         return $collection;
78     } 76     }
79  77 
80     public function getLoadedProductCollection() { 78     public function getLoadedProductCollection() {
81         return $this->getProducts(); 79         return $this->getProducts();
82     } 80     }
83  81 
84     public function getProductCount() { 82     public function getProductCount() {
85         $limit = $this->getData("product_count"); 83         $limit = $this->getData("product_count");
86         if(!$limit) 84         if(!$limit)
87             $limit = 10; 85             $limit = 10;
88         return $limit; 86         return $limit;
89     } 87     }
90 } 88 }